package com.zt.ThreadLocal;

/**
 * APP端的用户保存
 */
public class AdUserThreadLocalUtil {
    private final static ThreadLocal<Long> WM_USER_THREAD_LOCAL = new ThreadLocal<>();

    /**
     * 添加用户
     */
    public static void  setUserId(Long id){
        WM_USER_THREAD_LOCAL.set(id);
    }

    /**
     * 获取用户
     */
    public static Long getUserId(){
        return WM_USER_THREAD_LOCAL.get();
    }

    /**
     * 清理用户
     */
    public static void clear(){
        WM_USER_THREAD_LOCAL.remove();
    }
}
